define(['jquery', 'cm'], function () {
    $('footer').load('../html/footer.html')
    class Member {
        constructor() {
            this.data = getCookie('用户')
            this.head = getCookie('头像')
            console.log(this.data);
            this.juge()
        }
        juge() {
            var user = getCookie('用户')
            var users = JSON.parse(localStorage.getItem('curt')) || []
            var jugement = users.findIndex((item) => {
                return item.userName == user
            })
            var Data = JSON.parse(localStorage.getItem('shop' + jugement)) || []
            let count = 0
            Data.forEach((item) => {
                count += item.cart_number
            })
            console.log(count)
            if (getCookie('用户')) {
                let cookie = getCookie('用户')
                $('.login').html(`<a href="../html/member.html">${cookie}<img src="../imgaes/index/钻石.png" alt=""></a>`)
                $('.members .top .left').html(`<img src=${this.head}>`)
                $('.members .top .right .number').html(`<p>${this.data}</p>`)
                $('.members .middle .first p').html(`<p>${count}</p>`)
            }
        }
    }
    new Member()
})